package com.jasonidea.dockerdemo.controller;

import com.jasonidea.dockerdemo.service.DockerDemoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author jason315
 * @date 2021-12-10 21:52:20
 */
@RestController
public class DockerController {

    @Resource
    private DockerDemoService dockerDemoService;

    @GetMapping("/hello")
    public String helloDocker() {
        dockerDemoService.incrementVisitCount();
        return "hello docker";
    }

    @GetMapping("/visitCount")
    public String getVisitCount() {
        return String.format("自启动以来，当前被访问次数为: %d", dockerDemoService.getVisitCount());
    }
}
